package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BannerBean;
import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ChildGreatBean;
import com.xuxin.baby.bean.DoctorBean;
import com.xuxin.baby.bean.ReaderVideoBean;
import com.xuxin.baby.bean.UserChildBean;
import com.xuxin.baby.contract.MainContract;
import com.xuxin.baby.model.MainModel;

/**
 * Created by xu_xin
 * Created on 2020/10/01 0022
 * 首页
 */
public class MainPresenter implements MainContract.Presenter {
    private final MainModel model;
    private final MainContract.View view;

    public MainPresenter(MainContract.View view) {
        this.view = view;
        model = new MainModel();
    }

    @Override
    public void getUserChild(String tenantId, String token, String memberId) {
        if (null != model) {
            model.getUserChild(this, tenantId, token, memberId);
        }
    }

    @Override
    public void getBanner(String tenantId, String token) {
        if (null != model) {
            model.getBanner(this, tenantId, token);
        }
    }

    @Override
    public void getChildGreat(String tenantId, String token, String childId, String eventType, int skipCount) {
        if (null != model) {
            model.getChildGreat(this, tenantId, token, childId, eventType, skipCount);
        }
    }

    @Override
    public void getTips(String tenantId, String token, String categoryId) {
        if (null != model) {
            model.getTips(this, tenantId, token, categoryId);
        }
    }

    @Override
    public void getVideo(String tenantId, String token, String categoryId, String ageRge) {
        if (null != model) {
            model.getVideo(this, tenantId, token, categoryId, ageRge);
        }
    }

    @Override
    public void getReader(String tenantId, String token, String categoryId, String ageRge) {
        if (null != model) {
            model.getReader(this, tenantId, token, categoryId, ageRge);
        }
    }

    @Override
    public void getDoctor(String tenantId, String token, int skipCount) {
        if (null != model) {
            model.getDoctor(this, tenantId, token, skipCount);
        }
    }

    @Override
    public void updateCity(String tenantId, String token, String memberId, String city) {
        if (null != model) {
            model.updateCity(this, tenantId, token, memberId, city);
        }
    }

    @Override
    public void onSuccess(UserChildBean userChildBean) {
        if (null != view) {
            view.onSuccess(userChildBean);
        }
    }

    @Override
    public void onSuccess(BannerBean bannerBean) {
        if (null != view) {
            view.onSuccess(bannerBean);
        }
    }

    @Override
    public void onSuccess(ChildGreatBean childGreatBean) {
        if (null != view) {
            view.onSuccess(childGreatBean);
        }
    }

    @Override
    public void onSuccessTips(ReaderVideoBean readerVideoBean) {
        if (null != view) {
            view.onSuccessTips(readerVideoBean);
        }
    }

    @Override
    public void onSuccessVideo(ReaderVideoBean readerVideoBean) {
        if (null != view) {
            view.onSuccessVideo(readerVideoBean);
        }
    }

    @Override
    public void onSuccessReader(ReaderVideoBean readerVideoBean) {
        if (null != view) {
            view.onSuccessReader(readerVideoBean);
        }
    }

    @Override
    public void onSuccess(DoctorBean doctorBean) {
        if (null != view) {
            view.onSuccess(doctorBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}